<template>
  <div class="compatible-wrap">
    <div class="form-box table-box form-wrap">
      <el-form
          class="detail-wrap"
          :model="formData"
          :show-message="false"
          ref="formDataRef"
          label-width="140px"
      >
        <el-row>
          <el-col :span="24">
            <el-form-item label="角色名称：" prop="userId" required>
                            <el-input v-model="formData.name"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="启用状态：" prop="state" required>
              <el-radio-group v-model="formData.state">
                <el-radio value="0">启 用</el-radio>
                <el-radio value="1">停 用</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="备注：" prop="state" required>
              <el-input
                  v-model="formData.remarks"
                  type="textarea"
                  :autosize="{ minRows: 3, maxRows: 5 }"
                  maxlength="150"
                  show-word-limit
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="form-btn">
      <el-button @click="onClose">取消</el-button>
      <el-button type="primary" @click="onSubmit">确定</el-button>
    </div>
  </div>
</template>

<script setup>
import { useRoute } from "vue-router";
const route = useRoute();
const disabled = ref(false);
const formData = ref({
  workNumber: "",
  name: "",
  userId: "",
  userName: "",
  cardNumber: "",
  gender: "",
  mobile: "",
  departmentName: "",
  roleName: "",
  state: "",
  carType: "",
  certificateNumber: "",
  firstTime: "",
  startTimeEnd: [],
  remarks: '',
});
onMounted(async () => {
  let { id } = route.query;
  if (id) {
  }
});


const formDataRef = ref();
const onSubmit = () => {
  formDataRef.value.validate((valid) => {
    if (valid) {
      const params = {
        ...formData.value,
        startTime: formData.value.startTimeEnd[0],
        endTime: formData.value.startTimeEnd[1],
      };

    }
  });
};

const onClose = () => {
  closeDialog(true);
};
</script>

<style scoped lang="scss">

</style>
